<?php

/**
 * <li>Title: user.php</li>
 * <li>Project: Niu</li>
 * <li>Package: /app/models/</li>
 * <li>Description: models of user's validation </li>
 * <li>Copyright: Copyright (c) 2008</li>
 * <li>Company: Infolex LLC </li>
 * <li>Created on 2009-5-20</li>
 *
 * @author lei_zhong
 * @version 1.0
 */
class Change extends AppModel
{
	var $name='Change';
	function selectChangesInfo($prenum){
		$number=SystemProperties::$product_pageNumber;
		return $this->query("select * from g_changes   order by in_list desc,g_order desc,g_id desc limit $prenum,$number");
		//return $this->query("select g_id from g_changes  where $sql order by g_hot desc,g_id asc limit $prenum,$number");
	}
	
	function updateProductInList($pid,$in_list){
		$pid = intval($pid);
		$in_list = intval($in_list);
		$this->query("update g_changes set in_list = '{$in_list}' where g_id = {$pid} ");
	}
	function deleteProduct($key){
		$this->query("delete from g_changes where g_id in($key)");
	}
	function selectProduct($id){
		return $this->query("select * from g_changes  where g_id=$id");
	}
	function selectMoreProduct($ids){
		return $this->query("select * from g_changes  where g_id in($ids)");
	}
	function updateProduct($id,$sql){
		$this->query("update g_changes set $sql where g_id=$id");
	}
	function getMaxID(){
		$liberary_ary = $this->query('select last_insert_id() as liberary_id',false);
		return  $liberary_ary[0][0]['liberary_id']+1;
	}
}
?>